/*
 * @Author: DUST
 * @Date: 2023-05-29 15:09:00
 * @LastEditors: DUST
 * @LastEditTime: 2023-06-09 14:55:45
 * @FilePath: \koa-node-ts\app\model\Tags.ts
 * @Description:
 * undefined
 */
import { Column, DataType, Model, Table } from "sequelize-typescript";

@Table({
  tableName: "Tags",
  timestamps: true, // 自动维护时间
  freezeTableName: true, // 禁止修改表名，如果不写会把表名自动复数化，users
  paranoid: false, // 软删除
  indexes: [{ unique: true, fields: ["id"] }],
})
export default class Tags extends Model<Tags> {
  @Column({
    type: DataType.INTEGER.UNSIGNED,
    autoIncrement: true,
    primaryKey: true,
    allowNull: false,
    comment: "用户id",
  })
  id!: number;

  @Column({
    type: new DataType.STRING(128),
    allowNull: false,
    comment: "标签名称",
  })
  name!: string;

  @Column({
    type: new DataType.STRING(20),
    comment: "标签颜色",
  })
  color!: string;

  @Column({
    type: new DataType.INTEGER({ length: 4 }),
    defaultValue: 0,
    comment: "排序字段",
  })
  sortNum!: number;
}
